How do I go cookieless (disable Matomo cookies) for a visitor?
Matomo uses cookies to store some information about visitors between visits, however, it is possible to use Matomo Analytics without requiring cookies. Disabling cookies in Matomo does not automatically stop tracking — JavaScript-based tracking continues to run.
In most European countries, ePrivacy laws require websites to obtain consent before using any tracking technologies that fall into technical scope of these laws, including both cookies and JavaScript-based tracking, unless the tracking falls into the strictly necessary tracking exemption.
However, in some European jurisdictions, tracking without cookies may be exempt from consent requirements if no personal data, such as visitor IDs, is collected or stored and other conditions are met. Outside Europe, going cookieless may offer additional privacy benefits, as Matomo can be set up to avoid tracking or storing personal information altogether.
The method for disabling cookies is shown below and varies depending on which version of Matomo you are using.
Disable cookies for all sites within Matomo
If you never want to make use of cookies in any of your sites, then you can simply disable cookies for all sites.
Disable cookies for a specific site when you are using Matomo On-Premise or Matomo Cloud
See also: List of cookies used by Matomo.
If you have installed Matomo on your website with the JavaScript tracking code, it is easy to disable tracking cookies by adding one line in the Matomo Javascript code. Simply find the tracking code in your sites editor and look for the line that includes _paq.push(['trackPageView']);
and add the function _paq.push(['disableCookies']);
on the line before that. So afterwards that section of your code will look a little something like this:
[...]
// Call disableCookies before calling trackPageView
_paq.push(['disableCookies']);
_paq.push(['trackPageView']);
[...]
That’s it! Matomo will no longer collect any personal data through tracking cookies. If you’d only like to disable cookies until someone has consented to their use, view the developer documentation on cookie consent.
If you are using Matomo for WordPress
- Log in to your WordPress Admin Dashboard.
- Go to the Matomo Analytics section and open the Settings page.
- Scroll down to the Disable cookies checkbox and make sure it is selected.
- Scroll to the bottom of the page and click Save changes to confirm.
If you are using Matomo Tag Manager
There are two main ways of disabling cookies via Tag Manager, depending on whether you are using a cookie consent solution or not.
Cookies fully disabled
You can use a built-in feature that enables you to disable cookies. When setting up your Matomo configuration variable, make sure the Disable Cookies checkbox is enabled.
- When creating a Matomo Tag, you will see a Matomo Configuration setting. If you haven’t already created one, then click the Create New Matomo Configuration link to load the builder.
- Once it has loaded, complete all of the required details and then scroll down to the checkbox that says Disable cookies.
- Click Create New Variable to confirm your configuration.
When using Matomo Tag Manager with a cookie consent solution
If you still want to use cookies if user gives consent, then you can create a “Custom HTML” tag, and insert _paq.push(['requireCookieConsent']);
in this tag. You would also need to create a Trigger on “DOM Ready” (which will be executed first before the Pageview trigger). Then in your Custom HTML tag, set “Execute this tag when any of these triggers are triggered.” to “DOM Ready”.
Implications on data accuracy
Disabling cookies can impact the accuracy of Matomo reports, as cookies help track returning visitors. Learn more how cookie affect data accuracy in our FAQ: When cookies are disabled by a visitor, how does it impact Matomo reports accuracy?
Implication on cookie consent banner and asking user for consent
If you are required to ask for consent before any form or tracking, your cookie banner will still need to remain, but the list of tracking tools you need to disclose in the details of your cookie banner or in your cookie notice will change.
However, in some jurisdictions, cookieless tracking may qualify as consent-exempt if no personal data (such as visitor IDs) is stored. If you are only required to ask for tracking consent if you process personal data and you configure Matomo to not process any personal data, the consent may no longer be required.
Always check with your legal or privacy advisors, as they are best placed to understand and advise you on your compliance obligations.
Learn more about Can I use Matomo Analytics without asking for consent or cookie banner?
Essential non-analytics cookies that may still be created
Even when analytics cookies are disabled as show above, Matomo may set strictly necessary or essential cookies for security or functionality of enabled features. These include:
- MATOMO_SESSID – This is a temporary short-lived cookie that provides a nonce, a random number, which helps to prevent CSRF security issues while users opt-out of tracking.
- mtm_consent and mtm_consent_removed – When you’re asking for consent before tracking visitors, these two cookies may be created.
- _pk_testcookie – This cookie is used solely to check whether the visitor’s browser supports cookies. It does not contain any identifiers and is deleted immediately.
For more information about Matomo cookies refer to: What are the cookies created by Matomo JavaScript Tracking client?